home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / PROGRAMM / PROGEDIT / 0773.ZIP / SEIOIBM.D < prev    next >
Text File  |  1988-01-03  |  6KB  |  132 lines

  1. /*
  2.  * SEIOIBM.D : IBM PC dependent data structures ...
  3.  *
  4.  * Last updated: (see header message below)
  5.  *
  6.  */
  7.  
  8. #define SEBIN       "SE"                  /* SE executable name       */
  9. #define PCHELPFILE  "se.hlp"              /* help page filename       */
  10. #define PCROOTHELP  "\\se.hlp\0         " /*  " in root (or wherever) */
  11. #define HOLDFILE    "se.hld"              /* intermediate hold file   */
  12. #define GETANSI     "\033[6n\r"           /* get ansi status sequence */
  13.  
  14. #define AUTO        0                     /* argument order in        */
  15. #define WRAP        1                     /* option structure         */
  16. #define TABINC      2
  17. #define STLINE      3
  18. #define STCOL       4
  19. #define STMESSG     5
  20. #define FILL        6
  21. #define BROWSE      7
  22. #define DIVLINES    8
  23. #define STRIP8      9
  24. #define INFILE     10
  25. #define OUTFILE    11
  26. #define NARGS      12                     /* number of arguments      */
  27.  
  28. typedef struct _header {  char version;
  29.                           char release;
  30.                           char logon[50]; /* this is where the signon */
  31.                        };                 /*  message resides         */
  32.  
  33. struct _header header = { 1, 1,
  34.                           "ECS Screen Editor, 04-Jan-88. " /* signon message */
  35.                         };
  36.  
  37. static char *copyrite = "Copyright (C) 1988, Southampton University, UK.";
  38.  
  39. static char *logon_form = "%s%s(%s)\r\n%s\r\n";
  40.                                 /* ansi, signon, termid, copyrite */
  41.  
  42. typedef struct { char id;       /* option letter id */
  43.                  boolean swtch; /* switch (T) or value must follow (F) */
  44.                  char *arg;     /* actual or default value (can't use  */
  45.                } oprec;         /* union - trouble with initialiser)   */
  46.  
  47. static oprec options[] = {            /* #    desc. */
  48.  
  49.         { 'a', TRUE,  (char*) FALSE}, /* 0 auto indent mode */
  50.         { 'w', TRUE,  (char*) FALSE}, /* 1 wrap mode */
  51.         { 't', FALSE,         "8" },  /* 2 tab interval */
  52.         { 'l', FALSE,         "1" },  /* 3 start at line */
  53.         { 'c', FALSE,         "1" },  /* 4 start at column */
  54.         { 'm', FALSE, (char*) NULL},  /* 5 start up message */
  55.         { 'f', TRUE,  (char*) FALSE}, /* 6 fill mode */
  56.         { 'b', TRUE,  (char*) FALSE}, /* 7 browse mode */
  57.         { 'd', TRUE,  (char*) FALSE}, /* 8 divide lines */
  58.         { 'p', TRUE,  (char*) FALSE}, /* 9 strip parity */
  59.         { 0,   0,     (char*) NULL},  /* 10 infile */
  60.         { 0,   0,     (char*) NULL},  /* 11 outfile */
  61.         { 0,   0,     (char*) 0}
  62. };
  63.  
  64. static char *usg[] =
  65.                { "",
  66.                  "SE usage:",
  67.                  "  se [-abdfpw] [-t #] [-l #] [-c #] [-m msg] file [outfile]",
  68.                  "",
  69.                  "For help inside SE press <escape> then type HELP<return>.",
  70.                  "  Type <return> to get back to the text.",
  71.                  NULL };
  72.  
  73. static boolean
  74.         fn_key = FALSE;               /* true if function key macros in use */
  75.  
  76. typedef struct { int secode;          /* SE opcode */
  77.                  char termstr[3];     /* PC function key code */
  78.                } matchentry;
  79.  
  80. static matchentry matchtab[] = {      /* key label   */
  81.  
  82.         { k_help,     0, 71,   0xFF}, /* Home        Function code strings */
  83.         { k_backsp,   8, 0xFF, 0   }, /* <-grey      end in 0xFF because 0 */
  84.         { k_insert,   0, 82,   0xFF}, /* Ins         is a fn.code lead-in  */
  85.         { k_scroldown,0, 118,  0xFF}, /* Ctrl.PgDn   */
  86.         { k_down,     0, 80,   0xFF}, /* \|/         */
  87.         { k_downpage, 0, 81,   0xFF}, /* PgDn        */
  88.         { k_left,     0, 75,   0xFF}, /* <-          */
  89.         { k_dchar,    0, 83,   0xFF}, /* Del         */
  90.         { k_right,    0, 77,   0xFF}, /* ->          */
  91.         { k_scrolup,  0, 132,  0xFF}, /* Ctrl.PgUp   */
  92.         { k_up,       0, 72,   0xFF}, /* /|\         */
  93.         { k_uppage,   0, 73,   0xFF}, /* PgUp        */
  94.         { k_wleft,    0, 115,  0xFF}, /* Ctrl.<-     */
  95.         { k_wright,   0, 116,  0xFF}, /* Ctrl.->     */
  96.         { k_again,    0, 79,   0xFF}, /* End         */
  97.         { k_dline,    0, 59,   0xFF}, /* F1          */
  98.         { k_rstone,   0, 60,   0xFF}, /* F2          */
  99.         { k_restore,  0, 61,   0xFF}, /* F3          */
  100.         { k_scrolup,  0, 62,   0xFF}, /* F4          */
  101.         { k_wleft,    0, 63,   0xFF}, /* F5          */
  102.         { k_wright,   0, 64,   0xFF}, /* F6          */
  103.         { k_help,     0, 65,   0xFF}, /* F7    spare */
  104.         { k_scroldown,0, 66,   0xFF}, /* F8          */
  105.         { k_ignore,   0, 67,   0xFF}, /* F9    spare */
  106.         { k_verify,   0, 68,   0xFF}, /* F10         */
  107.  
  108.         { 0,          0, 0,    0 }
  109. };
  110.  
  111. static uchar
  112.      w_extn[] = {4, '.','$','$','$'},
  113.      b_extn[] = {4, '.','b','a','k'};
  114.  
  115. static int cur_start = 0;   /* size of SE cursor (-1 for no change)     */
  116.  
  117. static char *pairs[] = {        /* each element MUST be distinct */
  118.                                 /* and be compatible with strmatch() */
  119.  
  120.                           "(\377",      ")\377",       /* brackets     */
  121.                           "[\377",      "]\377",
  122.                           "{\377",      "}\377",
  123.                           "/*\377",     "*/\377",      /* C, Pascal    */
  124.                           "$(\377",     "$)\377",      /* BCPL         */
  125.                           "begin\377",  "end\377",     /* Pascal, etc. */
  126.                           "DO\377",     "END\377",     /* PL/M         */
  127.                           "#if\377",    "#endif\377",  /* C preproc.   */
  128.                           "\\begin\377","\\end\377",   /* TeX          */
  129.  
  130.                           NULL,         NULL           /* end of list  */
  131.                        };
  132.